package BE;

import java.util.EventObject;

import lejos.pc.comm.NXTInfo;
import sharedData.ADataItem;
import sharedData.MapData;

/**
 * Custom java bean containing data for NXT Data events.
 * 
 * @author Danny Johansen, Didzis Petkus, Liviu Berheci.
 *
 */
public class NXTDataEvent extends EventObject {

	private static final long serialVersionUID = 8505604160180012124L;
	private ADataItem data;
	private NXTInfo device;

	/**
	 * Constructor taking event data as parameters.
	 * 
	 * @param source - the {@link Object} the event fired from.
	 * @param nxtInfo - {@link NXTInfo} object to store.
	 * @param dataItem - {@link ADataItem} object to store.
	 */
	public NXTDataEvent(Object source, NXTInfo nxtInfo, ADataItem dataItem) {
		super(source);
		data = dataItem;
		device = nxtInfo;
	}

	/**
	 * Returns any data stored in this event.
	 * 
	 * @return {@link ADataItem} stored.
	 */
	public ADataItem getData() {
		return data;
	}

	/**
	 * Returns any device information stored in this event.
	 * 
	 * @return {@link NXTInfo} stored.
	 */
	public NXTInfo getDevice() {
		return device;
	}
	
	/**
	 * Stores the given <i>data</i> into this event.
	 * 
	 * @param data - {@link MapData} bean to store.
	 */
	public void setData(MapData data) {
		this.data = data; 
	}
}
